FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04

USER root

ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Shanghai

RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|https://mirrors.tuna.tsinghua.edu.cn/ubuntu/|g' /etc/apt/sources.list && \
    apt update && \
    apt upgrade -y && \
    echo "tzdata tzdata/Areas select Asia" | debconf-set-selections && \
    echo "tzdata tzdata/Zones/Asia select Shanghai" | debconf-set-selections && \
    apt install tzdata -y && \
    apt install build-essential vim git cmake ninja-build wget curl -y && \
    apt install llvm clang clangd clang-format -y && \
    apt install libboost-all-dev libeigen3-dev libfmt-dev libgoogle-glog-dev libopencv-dev -y && \
    apt install btop neofetch -y && \
    apt install openssh-server -y && \
    echo "root:123" | chpasswd && \
    sed -i 's/#\?PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config && \
    sed -i 's/#\?PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config

EXPOSE 22

WORKDIR /root

RUN rm /bin/sh && ln -s /bin/bash /bin/sh
    
RUN wget -q https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py311_25.5.1-1-Linux-x86_64.sh && \
    bash Miniconda3-py311_25.5.1-1-Linux-x86_64.sh -b -p /root/miniconda3
    
RUN source /root/miniconda3/bin/activate && \
    conda init bash && \
    rm Miniconda3-py311_25.5.1-1-Linux-x86_64.sh && \
    pip3 config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple && \
    pip3 install torch torchvision

